<template>
	<view class="">
		<view class="authorizedcell" v-for="(item,index) in authorizedList" :key="index">
			<view class="wrapper" @tap.stop="authorizedDetail(item.id)">
				<view class="cell-header">
					<view>
						{{item.name}}
					</view>
					<view class="right_cell">
						<view class="">
							<text class="blue" v-if='item.check_state==0'>待授权</text>
							<text class="red" v-if='item.check_state==1'>未通过</text>
							<text class='green' v-if='item.check_state==2'>已授权</text>
						</view>
						<view class="">
							<uni-icons type="arrowright" color="#bbbbbb" size="20" />
						</view>
					</view>
				</view>
				
				<view class="cell-content">
					<view class="organAddress">
						<view class="">
							<text>赛事规模:</text>
							<text>{{item.rank}}</text>
						</view>
						<view class="province_plan" v-if="item.isPlan===1&&item.check_state==0">
							省级计划
						</view>
						<view class="no_province_plan" v-if="item.isPlan==0&&item.check_state==0">
							非省级计划
						</view>
						<view class="society" v-if="item.check_state==0">
							{{item.orgName}}
						</view>
						<view class="society red" v-if="item.check_state==1&&item.checkName!==''">
							已拒绝
						</view>
						<view class="society" v-if="item.check_state==2">
							{{item.orgName}}
						</view>
					</view>
					<view class="organnum">
						<text>已申请机构数:</text>
						<text>{{item.isPlan===1?item.org:1}}</text>
					</view>
					<view class="signup" v-if="item.check_state=='2'">
						<view class="">
							<text>报名人数:</text>
							<text>{{item.payNum}}</text>
						</view>
						<view class="player_num">
							<text>参赛人数:</text>
							<text>{{item.playNum}}</text>
						</view>
					</view>
					<view class="organtime" v-if="item.gameTime[0]">
						<text>比赛时间:</text>
						<text>{{regTime(item.gameTime[0],item.gameTime[1])}}</text>
					</view>
					<view class="organtime" v-if="item.regTime[0]">
						<text>参赛时间:</text>
						<text>{{regTime(item.regTime[0],item.regTime[1])}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniIcons from '@/components/uni-icons/uni-icons.vue'
	export default{
		props:{
			authorizedList:Array
		},
		data(){
			return{
				
			}
		},
		components:{
			uniIcons
		},
		methods:{
			showTime (e) {
			  if (e !== null) {
					var date=new Date(e.slice(0,19).replace(/-/g, '/')),Y,M,D,h,m,s;
					Y = date.getFullYear() + '年';
					// M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '月';
					M = ( date.getMonth()+1) + '月';
					D = date.getDate() + '日';
					h = date.getHours() + ':';
					m = date.getMinutes() + ':';
					s = date.getSeconds(); 
			    return Y+M+D
			  } else {
			    return false
			  }
			},
			regTime(bTime,eTime){
				var _this=this;
				return _this.showTime(bTime)+"至"+_this.showTime(eTime)
			},
			authorizedDetail(id){
				var _this=this
				_this.$emit("toAuthorizedDetail",id)
			}
		}
	}
</script>

<style lang='less' scoped>
	.authorizedcell{
		background: #fff;
		margin-top:24rpx ;
		.wrapper{
			padding: 16rpx 32rpx 18rpx;
		}
	}
	.blue{
		color: #2D8DFF;
	}
	.red{
		color: #FF535A;
	}
	.green{
		color: #81D25A;
	}
	.cell-header{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		border-bottom: 2rpx solid #F6F7F9;
		/* height: 22rpx; */
		padding-bottom:18rpx ;
		.right_cell{
			display: flex;
			flex-direction: row;
			align-items: center;
		}
		view:first-child{
			font-size: 32rpx;
			width: 80%;
			align-self: center;
			max-height: 105rpx;
			overflow: hidden;
		}
		view:last-child{
			width: 20%;
			text-align: right;
			color: red;
			font-size: 24rpx;
			align-self: center;
		}
	}
	.cell-content{
		padding-top: 8rpx;
		font-size: 28rpx;
		>view{
			margin-top: 10rpx;
			text:last-child{
				margin-left: 18rpx;
			}
		}
		.signup{
			display: flex;
			flex-direction: row;
			/* padding-left: 10rpx; */
			.player_num{
				padding-left: 70rpx;
			}
		}
		.organAddress{
			display: flex;
			flex-direction: row;
			view{
				margin-left: 18rpx;
			}
			view:first-child{
				margin-left: 0;
			}
			.province_plan{
				font-size: 20rpx;
				padding: 0 6rpx;
				background: #FFC265;
				color: #fff;
				border-radius: 4rpx;
				height: 40rpx;
				align-self: center;
				line-height: 40rpx;
			}
			.no_province_plan{
				font-size: 20rpx;
				padding: 0 6rpx;
				background: #FFC265;
				color: #fff;
				border-radius:4rpx;
				height: 40rpx;
				align-self: center;
				line-height: 40rpx;
			}
			.society{
				font-size: 20rpx;
				padding: 0 6rpx;
				background: #2D8DFF;
				color: #fff;
				border-radius:4rpx;
				height: 40rpx;
				align-self: center;
				line-height: 40rpx;
			}
			.red{
				background: #FF535A;
				color: #fff;
			}
		}
	}
</style>
